<?php
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     block.lkajax.php
 * Type:     lkajax
 * Name:     lkajax
 * Purpose:  Crea un link ajax para afw
 * -------------------------------------------------------------
 */
function smarty_block_lkajax($params, $content, &$smarty, &$repeat)
{
    if (isset($content)) {
        $id=$params['id'];
        $clase=$params['class'];
        $p=$params['p'];
        if(p!=""){
        	//$url="<a href='#$p'";
        	$url="<a ";
        }
        if($id!=""){
        	$url.=" id='$id'";
        }
        if($clase!=""){
        	$url.=" class='$clase'";
        }
        $x=explode(".", $p);
        $div=$x[0];
        $peticion=substr($p, strlen($div)+1, (strlen($p) - strlen($div)));
        return $url . " onclick=\"cargar('$div', '$peticion');\" rel='ajax'>" . $content . "</a>";
    }
}
?>
